#ifndef OLED_H
#define OLED_H

#include "stdio.h"
#include "stdint.h"

#define XLevelL 0x00
#define XLevelH 0x10
#define Max_Column 128
#define Max_Row 64
#define Brightness 0xFF
#define X_WIDTH 128
#define Y_WIDTH 64

#define OLED_CMD 0  
#define OLED_DATA 1 

extern const unsigned char F6x8[][6];

void OLED_WR_Byte(uint8_t dat, uint8_t cmd);
void OLED_DisplayOn(void);
void OLED_DisplayOff(void);
void OLED_Init(void);
void OLED_Clear(void);

void OLED_SetPos(unsigned char x, unsigned char y);
void OLED_Print(uint8_t x, uint8_t y, char *p);
void OLED_PrintInv(uint8_t x, uint8_t y, char *str);
void OLED_DrawRP(uint8_t y, uint8_t len);
void OLED_PrintI(uint8_t x, uint8_t y , int value);

#define OLED_Printf(x, y, fmt, ...)                                            \
  do {                                                                         \
    char buffer[64];                                                           \
    sprintf(buffer, fmt, __VA_ARGS__);                                         \
    OLED_Print(x, y, buffer);                                     \
  \
} while (0)


#define OLED_PrintfInverse(x, y, fmt, ...)                                     \
  do {                                                                         \
    char buffer[20];                                                           \
    sprintf(buffer, fmt, __VA_ARGS__);                                         \
    OLED_PrintInv(x, y, buffer);                                    \
  \
} while (0)

#endif
